﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;

namespace Tebbee.Business.Server.Common.Email
{
    public class TebbeeMail
    {
        public static void SendMail(string to, string content, string sub)
        {
            var fromAddress = new MailAddress("mercuryumi@gmail.com", "The Tebbee Team");
            var toAddress = new MailAddress(to, "Customer");
            const string fromPassword = "acfmomosun";
            string subject = sub;
            string body = content;

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout = 20000,
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true
            })
            {
                smtp.Send(message);
            }
        }
    }
}